package edu.sctu.lab04;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

/**
 * @Author:Mrzhang
 * @Description:
 * @Date:2018.05.15 17:20
 **/
public class TestServlet extends HttpServlet {


    /**
     * 继承HttpServlet后，这个类就是一个Servlet
     */

    //重写doGet方法
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
       /* DataBase dataBase=new DataBase();
        List<User> userList= new ArrayList<>();
        try {
            userList = dataBase.getUserList();
        } catch (SQLException e) {
            e.printStackTrace();
        }

        req.setAttribute("userList",userList);


        //连接Jsp和Servlet
        req.getRequestDispatcher("/test.jsp").forward(req,resp);*/

        PrintWriter out=resp.getWriter();
        out.write("<h1>Hello,Servlet!!!</h1>");
    }




}
